package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum ParkEnum implements IEnum<Integer> {

    LIU(0, "柳园"),
    HE(1, "荷园"),
    JU(2, "菊园"),
    SONG(3, "松园");

    private int type;

    private String name;


    ParkEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static ParkEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static ParkEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
